package com.diqye.templet.regullation;

import com.diqye.templet.core.Regullation;

/**
	 * 数字规则
	 *
	 * @author 秦振龙
	 * @date 2013-7-2
	 *
	 * <b>修改记录及说明：</b>
	 * <ul>
	 * <li>2013-7-2  秦振龙  创建</li>
	 * </ul>
	 */
	public  class IntRegullation implements Regullation{

		public boolean invok(String context, int[] start, int[] end) {
			StringBuffer sbuf = new StringBuffer();
			int st = start[0];
			for(int i=st;i<context.length();i++){
				char c = context.charAt(i);
				if(c >= '0' && c <= '9'){
					if(sbuf.length() == 0){
						st = i;
					}
					sbuf.append(c);
				}else{
					if(sbuf.length() != 0){
						end[0] = i;
						start[0] = st;
						return true;
					}
				}
			}
			if(sbuf.length() != 0){
				start[0] = st;
				end[0] = context.length();
				return true;
			}
			return false;
		}
		
	}